<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>、
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>LarryBlogCMS-Home</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/common/bootstrap/css/bootstrap.css"
          media="all">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/main.css" media="all">
    <link href="${pageContext.request.contextPath}/common/bootstrap/css/bootstrap-select.min.css" rel="stylesheet" type="text/css">
    <link href="${pageContext.request.contextPath}/common/bootstrap/css/bootstrap-select.css" rel="stylesheet" type="text/css">

    <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/common/bootstrap/js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/pageJs/system/user.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/common/bootstrap/js/bootstrap-select.js">
    </script>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/common/bootstrap/css/bootstrap-select.css">
</head>
<body>
<div class="container">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">用户管理</h3>
        </div>
        <div class="panel-body">
            <form  id="userform" method="post" action="">
                <div class="col-xs-12">
                    <div class="form-group col-sm-3">
                        <label class="control-label">姓名：</label>
                        <input type="text" id="name" class="form-control" placeholder="请输入姓名" name="username" value="${meaningUser.username}">
                    </div>
                    <div class="form-group col-sm-3">
                        <label class="control-label">职位</label>
                        <select class="form-control"  id="user_role" style="height:35px;" name="roleId"value="${meaningUser.roleId}">
                        </select>
                    </div>
                    <div class="form-group col-sm-3">
                        <label class="control-label">手机号：</label>
                        <input type="text" id="phone" class="form-control" placeholder="xxx-xxxx-xxxx"name="userPhone"value="${meaningUser.userPhone}">
                    </div>
                    <div class="form-group col-sm-3">
                        <label class="control-label">性别</label>
                        <select class="form-control" id="status"  style="height:35px;"name="userSex" value="${meaningUser.userSex}">
                            <option value="">请选择</option>
                            <option value="1">男</option>
                            <option value="2">女</option>
                        </select>
                    </div>
                    <div class="form-group col-sm-3">

                        <label class="control-label">密码：</label>
                        <input type="password" multiple="multiple" class="form-control" placeholder="请输入密码"name="password" id="password">
                    </div>
                    <div class="form-group col-sm-3">
                        <label>科室</label>
                        <select id="id_select" class=" form-control"name="departmentId">
                        </select>
                    </div>

                    <div class="form-group col-sm-3">
                        <label class="control-label">邮箱：</label>
                        <input type="email"  class="form-control" placeholder="请输入邮箱" name="userEmail" id="email"value="${meaningUser.userEmail}">
                    </div>
                    <div class="form-group col-sm-3" style="display:none;" id="div4">
                        <label class="control-label">审核状态</label>
                        <select id="statu" class=" form-control"  name="userStatus">
                            <option value="">请选择</option>
                            <option value="1">审核中</option>
                            <option value="2">审核通过</option>
                            <option value="3">审核不通过</option>
                        </select>
                    </div>
                </div>
                    <div id="div2">
                        <div class="col-xs-6 text-left">
                            <button type="button"  class="btn btn-primary" id="add">新增</button>
                            <button type="button"  class="btn btn-primary" id="xg">修改,审核</button>
                            <button type="button"  class="btn btn-primary" id="del">删除</button>
                        </div>
                        <span id="error"></span>
                        <div class="col-xs-6 text-right">
                            <button type="button"  class="btn btn-primary"id="js">检索</button>
                            <button type="button"  class="btn btn-primary"id="qk">清空</button>
                        </div>
                    </div>
                    <div id="div3" class="col-xs-6 text-center" style="display:none;">
                        <button type="button"  class="btn btn-primary"id="bc">保存</button>
                        <button type="button"  class="btn btn-primary"id="fh">返回</button>
                    </div>
            </form>
        </div>
        </div>
            <table class="table table-bordered table-striped table-hover" style="background:lightblue">
                <thead>
                <tr>
                    <th class="col-sm-0.5 text-center" ><input type='checkbox'
                                                              id="all"></th>
                    <th class="col-sm-1 text-center">姓名</th>
                    <th class="col-sm-2 text-center">角色</th>
                    <th class="col-sm-1 text-center">性别</th>
                    <th class="col-sm-2 text-center">手机号</th>
                    <th class="col-sm-2 text-center">邮箱</th>
                    <th class="col-sm-2text-center">科室</th>
                    <th class="col-sm-2text-center">审核状态</th>
                </tr>
                </thead>
                <tbody>
                <c:if test="${empty page.list}">
                    查无数据
                </c:if>
                <c:forEach items="${page.list}" var="meaningUser" varStatus="i">
                    <tr <c:if test="${i.count%2==0 }">style="background:lightgreen"</c:if> >
                        <td class="col-sm-0.5 text-center"><input type='checkbox' value="${meaningUser.userId}"name="check" id="check"></td>
                        <td>${meaningUser.username}</td>
                        <td>${meaningUser.roleName}</td>
                        <td>
                            <c:if test="${meaningUser.userSex==1}">男</c:if>
                            <c:if test="${meaningUser.userSex==2}">女</c:if>
                        </td>
                        <td>${meaningUser.userPhone}</td>
                        <td>${meaningUser.userEmail}</td>
                        <td>${meaningUser.departmentName}</td>
                        <td>
                            <c:if test="${meaningUser.userStatus==1}">审核中</c:if>
                            <c:if test="${meaningUser.userStatus==2}">审核通过</c:if>
                            <c:if test="${meaningUser.userStatus==3}">审核不通过</c:if>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>

    <div class="text-center">
        <input type="hidden" value="{pageContext.request.contextPath}" id="path">
        <button class="btn btn-default" onclick="javasrcipt:changePage(${page.currentPage - 1})">上一页</button>
        <c:forEach begin="1" end="${page.totalPage }" varStatus="i">
            <button class="btn btn-default" onclick="javasrcipt:changePage(${i.count})">${i.count}</button>
        </c:forEach>
        <button class="btn btn-default" onclick="javasrcipt:changePage(${page.currentPage + 1})">下一页</button>
        <input type="hidden" id="totalPage" value="${page.totalPage}">
    </div>

</div>
</body>
<script type="text/javascript">

    var totalPage = $("#totalPage").val();
    function changePage(page){
        var data=$("#userform").serialize();
        console.log(data);
        if(page <= 0){
            alert("已经是首页");
        }else if(page > totalPage){
            alert("已经是尾页");
        }else{
            $("#currentPage").val(page);
            location.href="/selectuser?currentPage="+page+"&meaningUser="+data;
        }
    }
</script>
</html>